package drds.binlog.data_object;

import drds.binlog.common.Authors;
import drds.common.Author;

/**
 * <pre>
 * *打散后的事件类型，主要用于标识事务的开始，变更数据，结束*
 * </pre>
 */
@Author(name = Authors.LI_YANG)
public enum EntryType
{
    entrytypecompatibleproto2(0),
    transaction_begin(1),
    rowdata(2),
    transaction_end(3),
    /**
     * <pre>
     * * 心跳类型，内部使用，外部暂不可见，可忽略 *
     * </pre>
     */
    heartbeat(4),
    gtidlog(5),
    unrecognized(-1),;


    private final int value;

    private EntryType(int value)
    {
        this.value = value;
    }


    @Deprecated
    public static EntryType valueOf(int value)
    {
        return forNumber(value);
    }

    public static EntryType forNumber(int value)
    {
        switch (value)
        {
            case 0:
                return entrytypecompatibleproto2;
            case 1:
                return transaction_begin;
            case 2:
                return rowdata;
            case 3:
                return transaction_end;
            case 4:
                return heartbeat;
            case 5:
                return gtidlog;
            default:
                return null;
        }
    }


    public final int getNumber()
    {
        if (this == unrecognized)
        {
            throw new IllegalArgumentException(
                    "Can't get the number of an unknown enum value.");
        }
        return value;
    }


}
